package com.asp.alumnisystem.fragment;

import com.asp.alumnisystem.adapter.ForumListAdapter;
import com.asp.alumnisystem.app.App;
import com.asp.alumnisystem.model.ForumModel;
import com.asp.alumnisystem.presenter.ForumListPresenter;
import com.asp.alumnisystem.ui.PublishActivity;
import com.asp.alumnisystem.utils.UiUtils;
import com.asp.alumnisystem.view.TitleBar;

/**
 * 首页论坛页面
 */
public class ForumFragment extends AspBaseFragment<ForumModel>{

    @Override
    protected void initView() {
        setTitleStr("论坛");
        adapter = new ForumListAdapter(recyclerView);
        presenter = new ForumListPresenter(this);
        managerPresenter(presenter);
        recyclerView.setAdapter(adapter);
        onRefresh(null);

        if (!App.getApp().isVisitor()){
            TitleBar titleBar = recyclerView.getTitleBar();
            titleBar.setOptStr("发帖");
            titleBar.setListener(new TitleBar.OnTitleBarClickListener() {
                @Override
                public boolean onClickBackView() {
                    return false;
                }

                @Override
                public void onClickOptView() {
                    UiUtils.jumpToPage(getContext(), PublishActivity.class);
                }
            });
        }
    }

    @Override
    protected void destroy() {

    }

}
